package com.ss.android.article.base.feature.video;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Transformation;

import com.ss.android.article.browser.R;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class NoSoundTipView extends View {
    class NoSoundAnimation extends Animation {
        private NoSoundAnimation(NoSoundTipView arg1) {

        }

        protected void applyTransformation(float arg2, Transformation arg3) {
            super.applyTransformation(arg2, arg3);
            NoSoundTipView.this.invalidate();
        }
    }

    private static List heightSet;
    private Paint mBaseLinePaint;
    private Context mContext;
    private int mLineColor;
    private static int mRandIndex;
    private RectF mRectF1;
    private RectF mRectF2;
    private RectF mRectF3;
    private RectF mRectF4;

    static {
        NoSoundTipView.mRandIndex = 1;
        NoSoundTipView.heightSet = new ArrayList();
    }

    public NoSoundTipView(Context arg2) {
        super(arg2);
        this.mRectF1 = new RectF();
        this.mRectF2 = new RectF();
        this.mRectF3 = new RectF();
        this.mRectF4 = new RectF();
        this.init(arg2);
    }

    public NoSoundTipView(Context arg2, AttributeSet arg3) {
        super(arg2, arg3);
        this.mRectF1 = new RectF();
        this.mRectF2 = new RectF();
        this.mRectF3 = new RectF();
        this.mRectF4 = new RectF();
        this.init(arg2);
    }

    public NoSoundTipView(Context arg2, AttributeSet arg3, int arg4) {
        super(arg2, arg3, arg4);
        this.mRectF1 = new RectF();
        this.mRectF2 = new RectF();
        this.mRectF3 = new RectF();
        this.mRectF4 = new RectF();
        this.init(arg2);
    }

    private void init(Context arg3) {
        this.mContext = arg3;
        this.mLineColor = ContextCompat.getColor(this.mContext, R.color.white);
        this.mBaseLinePaint = new Paint(5);
        this.mBaseLinePaint.setStyle(Paint.Style.FILL);
        this.mBaseLinePaint.setColor(this.mLineColor);
        NoSoundTipView.heightSet.add(Integer.valueOf(10));
        NoSoundTipView.heightSet.add(Integer.valueOf(25));
        NoSoundTipView.heightSet.add(Integer.valueOf(35));
        NoSoundTipView.heightSet.add(Integer.valueOf(50));
    }

    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        this.startAnim();
    }

    protected void onDraw(Canvas arg6) {
        float v4 = 130f;
        super.onDraw(arg6);
        if(NoSoundTipView.mRandIndex % 3 == 0) {
            NoSoundTipView.mRandIndex = 0;
            Collections.shuffle(NoSoundTipView.heightSet);
        }

        ++NoSoundTipView.mRandIndex;
        this.mRectF1.set(75f, ((float)(((Integer)NoSoundTipView.heightSet.get(0)).intValue() + 60)), 85f, v4);
        this.mRectF2.set(90f, ((float)(((Integer)NoSoundTipView.heightSet.get(1)).intValue() + 60)), 100f, v4);
        this.mRectF3.set(105f, ((float)(((Integer)NoSoundTipView.heightSet.get(2)).intValue() + 60)), 115f, v4);
        this.mRectF4.set(120f, ((float)(((Integer)NoSoundTipView.heightSet.get(3)).intValue() + 60)), v4, v4);
        arg6.drawRect(this.mRectF1, this.mBaseLinePaint);
        arg6.drawRect(this.mRectF2, this.mBaseLinePaint);
        arg6.drawRect(this.mRectF3, this.mBaseLinePaint);
        arg6.drawRect(this.mRectF4, this.mBaseLinePaint);
    }

    public void setVisibility(int arg2) {
        if(arg2 == 8) {
            this.clearAnimation();
        }
        else {
            this.startAnim();
        }

        super.setVisibility(arg2);
    }

    public void startAnim() {
        NoSoundAnimation v0 = new NoSoundAnimation(this);
        v0.setDuration(1000);
        v0.setRepeatCount(-1);
        v0.setRepeatMode(1);
        this.startAnimation(((Animation)v0));
    }
}

